package club.zhilin.guli.service.cms.controller.portal;

import club.zhilin.guli.common.base.result.CommonResult;
import club.zhilin.guli.service.cms.domain.Ad;
import club.zhilin.guli.service.cms.service.IAdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhilin
 * @since 2022/2/23 18:43
 */
@RestController
@Api(value = "广告推荐管理")
@RequestMapping("/portal/cms/ad")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PortalAdController {

    private final IAdService iAdService;

    @ApiOperation("查询推荐列表")
    @GetMapping("/list/{adTypeId}")
    public CommonResult<List<Ad>> listByTypeId(@PathVariable String adTypeId) {
        List<Ad> ads = iAdService.selectByAdTypeId(adTypeId);
        return CommonResult.success(ads);
    }
}
